package com.liyongjian.xhban.dal;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;

import com.liyongjian.xhban.model.User;
import com.liyongjian.xhban.model.emumm.LiveDieState;

public interface UserRepository extends PagingAndSortingRepository<User, Long> {

    User findByIdAndState(Long id, LiveDieState state);

    @Query("select t from User t where (t.nickName like %:nickName% or t.id=:id) and t.state!=0")
    Page<User> findByUserNick(@Param("nickName") String nickName, @Param("id") Long id,
            Pageable pageable);

}
